package com.tool.cn.use.async;

import com.tool.cn.use.async.core.TaskIntr;

/**
 * 
 * @author wangzonghui
 * @date 2022-08-31 04:38:41
 * @Description 异步任务实现
 */
public class InterfaceModel implements  TaskIntr{
	
	private String name;
	
	@SuppressWarnings("unused")
	private InterfaceModel() {};
	public InterfaceModel(String name) {
		this.name=name;
	}

	@Override
	public void make() {
		System.out.println(Thread.currentThread().getName()+" "+name+" 开始执行任务");
		try {
			Thread.sleep(2000);
		} catch (InterruptedException e) {
			e.printStackTrace();
		}
		System.out.println(Thread.currentThread().getName()+" "+name+" 结束执行任务");
	}

	@Override
	public void success() {

		System.out.println(Thread.currentThread().getName()+" "+name+" 成功执行任务");
	}

	@Override
	public void error() {
		System.out.println(Thread.currentThread().getName()+" "+name+" 任务失败");
	}

}
